package leetcode.weekly.week310;

import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;

import leetcode.helper.H;

//Solution3Test
public class Solution3 {
	public int minGroups(int[][] intervals) {
		int[] hash = new int[1000005];
		for (int[] ints : intervals) {
			hash[ints[0]] += 1;
			hash[ints[1] + 1] -= 1;
		}
		long ans = 0, sum = 0;
		for (int i = 0; i < hash.length; i++) {
			sum += hash[i];
			if (sum > ans) {
				ans = sum;
			}
		}
		return (int) ans;
	}

}
